import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerBusinessLaborIncomeApi {
  /** 劳务所得情况业务信息 */
  export interface BusinessLaborIncome {
    id: number; // 主键ID
    busiId?: string; // 业务主表id
    laborIncomeId: number; // 正式表ID，对应 per_labor_income.id
    employeeId?: number; // 人员ID，对应 per_employee.id
    lectureFee: number; // 讲学收入
    writingFee: number; // 写作收入
    consultingFee: number; // 咨询收入
    reviewFee: number; // 审稿收入
    paintingFee: number; // 书画收入
    otherFee: number; // 其他收入
    totalAmount: number; // 合计收入
    year: string; // 年度
    status: number; // 状态（1：有效，0：无效）
    changeType: string; // 变更类型（add：新增，update：修改，delete：删除）
    changeContent: string; // 变更内容(JSON格式，记录变更前后对比，只有修改的时候记录)
    auditStatus: number; // 审核状态（0 草稿 1 审核中 2 审核完成）
    finalAuditStatus: number; // 最终审核状态：0 待审核 1 审核通过 2 审核不通过
    auditTime: string | Dayjs; // 审核完成时间
    auditor: string; // 审核人
    auditComment: string; // 审核意见
    metadata: string; // 其他参数
  }
}

/** 查询劳务所得情况业务分页 */
export function getBusinessLaborIncomePage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerBusinessLaborIncomeApi.BusinessLaborIncome>>('/per/business-labor-income/page', data,{ desensitize,encrypt });
}

/** 查询劳务所得情况业务详情 */
export function getBusinessLaborIncome(id: number) {
  return requestClient.get<PerBusinessLaborIncomeApi.BusinessLaborIncome>(`/per/business-labor-income/get?id=${id}`);
}

/** 新增劳务所得情况业务 */
export function createBusinessLaborIncome(data: PerBusinessLaborIncomeApi.BusinessLaborIncome) {
  return requestClient.post('/per/business-labor-income/create', data);
}

/** 修改劳务所得情况业务 */
export function updateBusinessLaborIncome(data: PerBusinessLaborIncomeApi.BusinessLaborIncome) {
  return requestClient.put('/per/business-labor-income/update', data);
}

/** 删除劳务所得情况业务 */
export function deleteBusinessLaborIncome(id: number) {
  return requestClient.delete(`/per/business-labor-income/delete?id=${id}`);
}

/** 批量删除劳务所得情况业务 */
export function deleteBusinessLaborIncomeList(ids: number[]) {
  return requestClient.delete(`/per/business-labor-income/delete-list?ids=${ids.join(',')}`)
}

/** 导出劳务所得情况业务 */
export function exportBusinessLaborIncome(params: any) {
  return requestClient.download('/per/business-labor-income/export-excel', { params });
}

/** 根据业务主表id去查询业务数据 */
export function getLaborIncomeBusiId(data: any) {
  return requestClient.post<PerBusinessLaborIncomeApi.BusinessLaborIncome>(
    `/per/business-labor-income/getLaborIncomeBusiId`,
    data,
  );
}

/** 获取当前登录人劳务所得情况 */
export function getCurrentLaborIncome(
  data: any,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<PerBusinessLaborIncomeApi.BusinessLaborIncome[]>(
    '/per/business-labor-income/getCurrentLaborIncome',
    data,
    {
      desensitize,
      encrypt,
    },
  );
}
